﻿/*!
* Chef Framework v0.1
* Copyright 2010, I-Technology.NET, http://chef.codeplex.com
* Distributed in whole under the terms of the MIT license
* http://www.opensource.org/licenses/mit-license.php 
* 
* Author
* Robert Hoffmann
*/
jQuery.extend({
    jsonP: function(path, callBack) {
        var tmp = callBack;

        window.callback = function (data) {
            tmp(data);
            window.callback = undefined;
        };   
            
        jQuery.ajax({
            url     : path,
            dataType: "jsonp",
        });                    
    },

    loadXedit: function() {        
        if (!window.ixedit) {
            ixedit = {};

            ixedit.js      = document.createElement('script');
            ixedit.js.src  = "../design/js/interface/ixedit/ixedit.packed.js";
            ixedit.js.type = "text/javascript";

            ixedit.css      = document.createElement('link');
            ixedit.css.href = "../design/js/interface/ixedit/ixedit.css";
            ixedit.css.type = "text/css";
            ixedit.css.rel  = "stylesheet";

            document.getElementsByTagName('head')[0].appendChild(ixedit.js);
            document.getElementsByTagName('head')[0].appendChild(ixedit.css);
        }
    },

    loadThemeRoller: function() {
            if(window.jquitr) {
                jquitr.addThemeRoller();
            }
            else {
                jquitr       = {};
                jquitr.s     = document.createElement('script');
                jquitr.s.src = 'http://jqueryui.com/themeroller/developertool/developertool.js.php';

                document.getElementsByTagName('head')[0].appendChild(jquitr.s);
            }
    },

    loadFirebugLite: function() {
        if (!window.fblite) {
            fblite = {};

            fblite.js      = document.createElement('script');
            fblite.js.src  = "http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js";
            fblite.js.type = "text/javascript";

            document.getElementsByTagName('head')[0].appendChild(fblite.js);
            firebug.init();
        }    
    }
});